<template>
  <h2>Provide-Inject - {{ name }}</h2>
  <button @click="add">btn</button>
  <Child />
</template>

<script>
import { provide, ref } from "vue";
import Child from "../components/09-Child.vue";
export default {
  components: {
    Child,
  },
  setup() {
    const name = ref("junjun");
    const add = () => {
      name.value = "juner";
    };

    //todo provide两个参数
    provide("name", name);

    return {
      name,
      add,
    };
  },
};
</script>
